﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _6._2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }
        public class student
        {
            private int number;
            private string name;
            private string sex;
            private string age;
            private string subject;
            public int Number
            {
                get
                {
                    return number;
                }
            }
            public string Name
            {
                get
                {
                    return name;
                }
            }
            public string Sex
            {
                get
                {
                    return sex;
                }
            }
            
            public string GetMessage()
            {
                return string.Format("添加学生信息为：\n学号:{0}\n姓名:{1}\n性别:{2}\n年龄:{3}\n专业:{4}\n", number, Name, sex, age, subject);
            }
            public student(int m_number, string m_name, string m_sex, string m_age, string m_subject)
            {
                this.number = m_number;
                this.name = m_name;
                this.sex = m_sex;
                this.age = m_age;
                this.subject = m_subject;

            }
        }

        private void btnDisplay_Click(object sender, EventArgs e)
        {
            student s = new student(Convert.ToInt32(txtNumber.Text),txtName.Text,txtSex.Text,txtAge.Text,txtSubject.Text);
            lblShow.Text=s.GetMessage();
        }
    }
}
